{template 'header', $module}
<div class="main-block bd-gray">
	<div class="hd fn-clear">
		<h2 class="fn-left">讯都合作</h2>
	</div>
    <div class="main-nav fn-clear">
	<ul id="data-nav" class="fn-left fn-clear">
		<!--<li id="status_1"><a href="cooper.php?action=direct_sale&status=1">产品直销</a></li>-->
		<li id="status_2"><a href="cooper.php?action=cooperation&status=2">项目合作</a></li>
		<li id="status_3"><a href="cooper.php?action=bailout&status=3">车企融资</a></li>
		<li id="status_4"><a href="cooper.php?action=recommend&status=4">项目推荐</a></li>
		<li id="status_5"><a href="cooper.php?action=bbs_add&status=5">社区新增板块</a></li>
	</ul>
    </div>
<!--{if $action == 'direct_sale'}
	<form id="pub-form" name="pub-form" method="post" action="{url('member/cooper')}">
		<input type="hidden" name="action" value="{$action}"/>
		<input type="hidden" name="post[company]" value="{$user[company]}"/>
		<table id="cooper-product" class="cooper-apply-tb" width='700'>
			<caption>产品入驻直销商城申请表</caption>
            <thead>
            <tr>
                <th width='40'>序号</th>
                <th width='150'>产品名称</th>
                <th width='90'>年产量</th>
                <th width='100'>拟销售范围</th>
                <th width='100'>最低供货量</th>
                <th width='100'>最低出厂价</th>
                <th width='130'>备注</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td class="w40"><input type="text" disabled='true' value="1" name="post[id][]"></td>
                <td class="w150"><input type="text" name="post[product][]"></td>
                <td class="w90"><input type="text" name="post[year][]"></td>
                <td class="w100"><input type="text" name="post[sales][]"></td>
                <td class="w100"><input type="text" name="post[buy][]"></td>
                <td class="w100"><input type="text" name="post[chuchang][]"></td>
                <td class="w130"><input type="text" name="post[note][]"></td>
            </tr>
            <tr>
	            <td class="w40"><input type="text" disabled='true' value="2" name="post[id][]"></td>
	            <td class="w150"><input type="text" name="post[product][]"></td>
	            <td class="w90"><input type="text" name="post[year][]"></td>
	            <td class="w100"><input type="text" name="post[sales][]"></td>
	            <td class="w100"><input type="text" name="post[buy][]"></td>
	            <td class="w100"><input type="text" name="post[chuchang][]"></td>
	            <td class="w130"><input type="text" name="post[note][]"></td>
            </tr>
            <tr>
	            <td class="w40"><input type="text" disabled='true' value="3" name="post[id][]"></td>
	            <td class="w150"><input type="text" name="post[product][]"></td>
	            <td class="w90"><input type="text" name="post[year][]"></td>
	            <td class="w100"><input type="text" name="post[sales][]"></td>
	            <td class="w100"><input type="text" name="post[buy][]"></td>
	            <td class="w100"><input type="text" name="post[chuchang][]"></td>
	            <td class="w130"><input type="text" name="post[note][]"></td>
            </tr>
            <tr>
	            <td class="w40"><input type="text" disabled='true' value="4" name="post[id][]"></td>
	            <td class="w150"><input type="text" name="post[product][]"></td>
	            <td class="w90"><input type="text" name="post[year][]"></td>
	            <td class="w100"><input type="text" name="post[sales][]"></td>
	            <td class="w100"><input type="text" name="post[buy][]"></td>
	            <td class="w100"><input type="text" name="post[chuchang][]"></td>
	            <td class="w130"><input type="text" name="post[note][]"></td>
            </tr>
            <tr>
	            <td class="w40"><input type="text" disabled='true' value="5" name="post[id][]"></td>
	            <td class="w150"><input type="text" name="post[product][]"></td>
	            <td class="w90"><input type="text" name="post[year][]"></td>
	            <td class="w100"><input type="text" name="post[sales][]"></td>
	            <td class="w100"><input type="text" name="post[buy][]"></td>
	            <td class="w100"><input type="text" name="post[chuchang][]"></td>
	            <td class="w130"><input type="text" name="post[note][]"></td>
            </tr>
            <tr><td colspan="7"><a id='apply-add' href="javascript:void(0);" class="btn fn-right">继续添加</a></td> </tr>
            <tr><td colspan="7" class="nobd">
                <div class="cooper-apply-bot fn-clear">
                    <p class="fn-left">特此申请！</p>
                    <table class="fn-right">
                        <tr>
                            <th width="100" >联系人：</th>
                            <td width="120"><input type="text" name="post[truename]" value="{$user[truename]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系人'"></td>
                        </tr>
                        <tr>
                            <th>联系手机：</th>
                            <td><input type="text"  name="post[phone]" value="{$user[mobile]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系手机'"></td>
                        </tr>
                        <tr>
                            <th>联系邮箱：</th>
                            <td><input type="text"  name="post[email]" value="{$user[email]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'email',missingMessage:'请填写email'"></td>
                        </tr>
                        <tr>
                            <th>&nbsp;</th>
                            <td>
                                <button type="submit" class="btn fn-left mr5">提交</button>
                                <input type="button" value="返回" class="btn fn-left" />
                            </td>
                        </tr>
                    </table>
                </div>
            </td></tr>
            </tbody>
		</table>
	</form>
	<script type="text/javascript">
	    seajs.use(['$'],function($){
            $("#apply-add").click(function(){
                var num = $('#cooper-product>tbody>tr').length-1, applyHtml, $nextNode = $(this).parents('tr');
                if(num<=20){
                    applyHtml = '<tr><td class="w40"><input type="text" disabled="true" value="'+num+'"></td>'+
                            '<td class="w150"><input type="text" name="post[product][]"></td>'+
                            '<td class="w90"><input type="text" name="post[year][]"></td>'+
                            '<td class="w100"><input type="text" name="post[sales][]"></td>'+
                            '<td class="w100"><input type="text" name="post[buy][]"></td>'+
                            '<td class="w100"><input type="text"  name="post[chuchang][]"></td>'+
                            '<td class="w130"><input type="text" name="post[note][]"></td></tr>'
                    $(applyHtml).insertBefore($nextNode);
                }else{
                    alert('最多只能添加20个产品')
                }
            });
        });
	</script>
	{/if}-->
	{if $action == 'cooperation'}
	<form id="pub-form" name="pub-form" method="post" action="{url('member/cooper')}">
		<input type="hidden" name="action" value="{$action}"/>
        <div class='group-apply-form apply-form'>
            <h2>项目合作申请单</h2>
            <p>我单位<input class="underline" type="text" size="25" name="post[company]" value="{$user[company]}">(整车、配件用品、设备、服务、专利、广告)拟和讯都车网进行合作
	           , 合作形式暂拟定：
            <textarea rows="3" cols="100" name="post[text][]"></textarea>
            具体形式由合作双方共同协定。
            </p>
            <div class="cooper-apply-bot fn-clear">
                <p class="fn-left">特此申请！</p>
                <table class="fn-right">
	                <tr>
		                <th width="100" >联系人：</th>
		                <td width="120"><input type="text" name="post[truename]" value="{$user[truename]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系人'"></td>
	                </tr>
	                <tr>
		                <th>联系手机：</th>
		                <td><input type="text"  name="post[phone]" value="{$user[mobile]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系手机'"></td>
	                </tr>
	                <tr>
		                <th>联系邮箱：</th>
		                <td><input type="text"  name="post[email]" value="{$user[email]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'email',missingMessage:'请填写email'"></td>
	                </tr>
                    <tr>
                        <th>&nbsp;</th>
                        <td>
                            <button type="submit" class="btn fn-left mr5">提交</button>
                            <input type="button" value="返回" class="btn fn-left" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
	 </form>
	{/if}
	{if $action == 'bailout'}
	<form id="pub-form" name="pub-form" method="post" action="{url('member/cooper')}">
		<input type="hidden" name="action" value="{$action}"/>
        <div class="finance-apply-form apply-form">
            <h2>企业融资申请单</h2>
            <p>企业名称：<input type="text" size="60" class="underline" name="post[company]" value="{$user[company]}"></p>
            <p>注册资本金：<input type="text" size="30" class="underline" name="post[ziben]">（万元）</p>
            <p>企业经营概况：
                <textarea rows="10" name="post[gaikuang]"></textarea>
            </p>
            <p>拟需求资金：<input type="text" size="30" class="underline" name="post[need]">（万元）</p>
            <p>需求资金用途：
                <textarea rows="10" name="post[yongtu]"></textarea>
            </p>
            <div class="cooper-apply-bot fn-clear">
                <p class="fn-left">特此申请！</p>
                <table class="fn-right">
	                <tr>
		                <th width="100" >联系人：</th>
		                <td width="120"><input type="text" name="post[truename]" value="{$user[truename]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系人'"></td>
	                </tr>
	                <tr>
		                <th>联系手机：</th>
		                <td><input type="text"  name="post[phone]" value="{$user[mobile]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系手机'"></td>
	                </tr>
	                <tr>
		                <th>联系邮箱：</th>
		                <td><input type="text"  name="post[email]" value="{$user[email]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'email',missingMessage:'请填写email'"></td>
	                </tr>
                    <tr>
                        <th>&nbsp;</th>
                        <td>
                            <button type="submit" class="btn fn-left mr5">提交</button>
                            <input type="button" value="返回" class="btn fn-left" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
	</form>
	{/if}
	{if $action == 'recommend'}
	<form id="pub-form" name="pub-form" method="post" action="{url('member/cooper')}">
		<input type="hidden" name="action" value="{$action}"/>
	<div class="finance-apply-form apply-form">
		<h2>项目（产品）推荐申请单</h2>
		<p>企业名称：<input type="text" size="60" class="underline" name="post[company]" value="{$user[company]}"></p>
		<p>注册资本金：<input type="text" size="30" class="underline" name="post[ziben]">（万元）</p>
		<p>企业经营概况：
			<textarea rows="10" name="post[gaikuang]"></textarea>
		</p>
		<p>我单位需要关于<input class="underline" type="text" size="50" name="post[xiangmu]">方面的项目（产品）
			推荐信息，敬请推荐！
		</p>
		<div class="cooper-apply-bot fn-clear">
			<p class="fn-left">特此申请！</p>
			<table class="fn-right">
				<tr>
					<th width="100" >联系人：</th>
					<td width="120"><input type="text" name="post[truename]" value="{$user[truename]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系人'"></td>
				</tr>
				<tr>
					<th>联系手机：</th>
					<td><input type="text"  name="post[phone]" value="{$user[mobile]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系手机'"></td>
				</tr>
				<tr>
					<th>联系邮箱：</th>
					<td><input type="text"  name="post[email]" value="{$user[email]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'email',missingMessage:'请填写email'"></td>
				</tr>
				<tr>
					<th>&nbsp;</th>
					<td>
						<button type="submit" class="btn fn-left mr5">提交</button>
						<input type="button" value="返回" class="btn fn-left" />
					</td>
				</tr>
			</table>
		</div>
	</div>
	</form>
	{/if}
	{if $action == 'bbs_add'}
	<form id="pub-form" name="pub-form" method="post" action="{url('member/cooper')}">
		<input type="hidden" name="action" value="{$action}"/>
		<input type="hidden" name="post[company]" value="{$user[company]}"/>
	<div class='group-apply-form apply-form'>
		<h2>讯都社区新增板块申请单</h2>
		<p>
			我单位拟在讯都社区申请新增关于
			<input class="underline" type="text" size="25" name="post[module]">
			内容的社区板块，社区管理形式暂拟定：
			<textarea rows="3" cols="100" name="post[text]"></textarea>
			具体开设、管理形式按讯都社区规定设置，望尽快联系开通
		</p>
		<div class="cooper-apply-bot fn-clear">
			<p class="fn-left">特此申请！</p>
			<table class="fn-right">
				<tr>
					<th width="100" >联系人：</th>
					<td width="120"><input type="text" name="post[truename]" value="{$user[truename]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系人'"></td>
				</tr>
				<tr>
					<th>联系手机：</th>
					<td><input type="text"  name="post[phone]" value="{$user[mobile]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系手机'"></td>
				</tr>
				<tr>
					<th>联系邮箱：</th>
					<td><input type="text"  name="post[email]" value="{$user[email]}" class="graybd-ipt easyui-validatebox input-left" data-options="required:true,validType:'email',missingMessage:'请填写email'"></td>
				</tr>
				<tr>
					<th>&nbsp;</th>
					<td>
						<button type="submit" class="btn fn-left mr5">提交</button>
						<input type="button" value="返回" class="btn fn-left" />
					</td>
				</tr>
			</table>
		</div>
	</div>
	</form>
	{/if}
</div>
<script type="text/javascript">
	seajs.use(['member','$','easyui','easyui-css',], function(member, $){
		member.active('menu_cooper', '{$action}', 'status_{$status}');
		$('#pub-form').on('submit', function(){
			<!--{if $action == 'direct_sale'}-->
			var proVal = '';
			$("input[name='post[product][]']").each(function(){
				proVal += $.trim($(this).val());
			})
			if (proVal == '') {
				$.messager.alert('警告','请填写完整商品信息！');
				return false;
			}
			<!--{/if}-->
			<!--{if $action != 'direct_sale'}-->
			var $ids = $(this).find('input,textarea');
			for(var id in $ids ) {
				if ($ids[id].tagName == 'INPUT' || $ids[id].tagName == 'TEXTAREA' ) {
					if ( $.trim($($ids[id]).val()) == '') {
						$.messager.alert('警告','请填写完整的申请单！', '', function(){
							$($ids[id]).focus();
						});
						return false;
					}
				}

			}
			<!--{/if}-->
			return $('#pub-form').form('validate');

		})
		<!--{if $action == 'direct_sale'}-->
		$("input[name='post[product][]']").each(function(){
			$(this).on('keyup change',function(){
				var val = $(this).val();
				if(val.length){
					$(this).parents('td').siblings('td').children('input').each(function(index){
						if(index>0&&index<5){
							$(this).validatebox({
								required:true,
								missingMessage:'请填写产品信息'
							});
						}
					});
				}else{
					$(this).parents('td').siblings('td').children('input').each(function(index){
						if(index>0&&index<5){
							$(this).validatebox({
								required:false
							});
						}
					});

				}
			});
		});
		<!--{/if}-->
	})
</script>
{template 'footer', $module}